package cn.azzhu.day02

import org.apache.flink.streaming.api.functions.co.CoMapFunction
import org.apache.flink.streaming.api.scala._

/**
 * @author azzhu
 * @create 2020-09-21 00:17:24
 */
object RedistributeExample {
  def main(args: Array[String]): Unit = {
    val env = StreamExecutionEnvironment.getExecutionEnvironment

    val stream = env.addSource(new SensorSource)

    stream.shuffle
    stream.rebalance

    //接收者任务的数量是发送者任务的数量的倍数时，rescale操作将会效率更高
    stream.rescale

    stream.broadcast

    env.execute("RedistributeExample")
  }
}
